#include "cStateMachine.h"

void GameStateMachine::pushState(GameState* pStatic)
{
	m_gameState.push_back(pStatic);
	m_gameState.back()->onEnter();
}

void GameStateMachine::changeState(GameState* pStatic)
{
	if (!m_gameState.empty())
	{
		if (m_gameState.back()->getStateID() == pStatic->getStateID())
		{
			return; // do nothing
		}

		if (m_gameState.back()->onExit())
		{
			delete m_gameState.back();
			m_gameState.pop_back();
		}
	}

	// push back our new static

	m_gameState.push_back(pStatic);

	// initialise it
	m_gameState.back()->onEnter();
}

void GameStateMachine::popState()
{

}